home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Workspace / Locus / Source / Locus_main.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  53 lines

  1.  
  2. /*
  3.     Copyright 1993  Jeremy Slade.
  4.  
  5.     You are free to use all or any parts of the Locus project
  6.     however you wish, just give credit where credit is due.
  7.     The author (Jeremy Slade) shall not be held responsible
  8.     for any damages that result out of use or misuse of any
  9.     part of this project.
  10.  
  11. */
  12.  
  13. /*
  14.     Project: Locus
  15.  
  16.     File: Locus_main
  17.  
  18.     Description:
  19.  
  20.     This file contains main(), whose standard responsibility is simply to create the NXApp instance, load the main nib section, and start the run loop.  Locus doesn't use the default main file generated by ProjectBuilder, because this main() also has an additional responsibility: it checks all the command-line arguments, look for one that says "DEBUGGING".  If it is found, the global variable DEBUGGING is turned on.  This is used in development to make Locus behave differently when run for testing purposes.  Of course, most people do this with #ifdef DEBUG ... style constructs, but I'm not fond of having lots of #ifdef's in my code, so I din't it another way.  I also think this method is more convenient to use as you don't have to worry about compiling a separate debug and non-debug version.  It would probably be a good idea at some point to put an #ifdef around the code in here that checks for this, so that you could compile a version which will not ever check for this option.
  21.     
  22.     Original Author: Jeremy Slade
  23.  
  24.     Revision History:
  25.         Created
  26.             V.101    JGS    Tue Apr 20 20:47:38 PDT 1993
  27.  
  28. */
  29.  
  30.  
  31. #import "CustomApp.h"
  32. #import "Globals.h"
  33.  
  34. void main(int argc, char *argv[])
  35. {
  36.     int i;
  37.     
  38.     // Check for DEBUGGING setting
  39.     DEBUGGING = NO;
  40.     for ( i=1; i<NXArgc; i++ ) if ( !strcasecmp ( NXArgv[i], "DEBUGGING" ) ) {
  41.         DEBUGGING = YES;
  42.         break;
  43.     }
  44.  
  45.     // Do standard stuff for main():
  46.     [CustomApp new];
  47.     if ([NXApp loadNibSection:"Main.nib" owner:NXApp withNames:NO])
  48.         [NXApp run];
  49.         
  50.     [NXApp free];
  51.     exit(0);
  52. }
  53.